import { useRef } from 'react';

export default function RefInput() {
  const inputRef = useRef(null);

  const onButtonClick = () => {
    inputRef.current.focus();
  };
  return (
    <>
      <input ref={inputRef} type="text" />
      <button onClick={onButtonClick}>聚焦输入框</button>
    </>
  );
}
